import Koa from 'koa'
import http from 'http'
import Init from '@/core/init'
import Config from '@/config/Config'
import initTask from '@/server/task'
// 创建koa实例
const app = new Koa()

//创建服务器
const server: http.Server = new http.Server(app.callback())

// 执行初始化
Init.initCore(app, server)
// 初始化任务
initTask()

// 监听端口
app.listen(Config.HTTP_PORT, () => {
  console.log(`http server running app port ${Config.HTTP_PORT}`)
  console.log('process.env.NODE_ENV:', process.env.NODE_ENV)
  console.log('打印这一行，说明服务已经启动成功！')
})
